import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 2.15

Window {
    width: 520
    height: 500
    visible: true
    title: qsTr("window")







    // signal: my_signal() 

    minimumWidth: 50
    minimumHeight: 50
    maximumWidth: 300
    maximumHeight: 300
    color: "gray"
    opacity: 0.8
    property int my_Value: 1


    onWidthChanged: {
        console.log("Width: ", width)
    }
    onHeightChanged: {
        console.log("Height: ", height)
    }

    onMy_ValueChanged: {
        console.log("My value: ", my_value)
    }


    Button {
        id: btn1
        x: 20
        y: 20
        width: 40
        height: 40
        focus: true
        objectName: "btn1"
        background:Rectangle {
            border.color: btn1.focus ? "blue" : "red"
        }
        onClicked: {
            console.log("Button 1 clicked")
        }
        Keys.onRightPressed: {
            btn2.focus = true
        }
    }

    Button {
        id: btn2
        x: 100
        y: 20
        width: 40
        height: 40
        objectName: "btn2"
        background:Rectangle {
            border.color: btn2.focus ? "blue" : "red"
        }
        onClicked: {
            console.log("Button 2 clicked")
        }
        Keys.onLeftPressed: {
            btn1.focus = true
        }
    }

    onActiveFocusItemChanged: {
        console.log("Active focus changed: ", activeFocusItem)
    }

}
